<?php 
	include_once("../config/database.php");
	class Ban extends database{
		private $msBan;
		private $maLoaiBan;
		private $maTrangThai;
		private $tang;
		
		public function setMsBan($msBan){
			$this->msBan = $msBan;
		}
		public function getMsBan(){
			return $this->msBan;
		}
		public function setMaLoaiBan($maLoaiBan){
			$this->maLoaiBan = $maLoaiBan;
		}
		public function getMaLoaiBan(){
			return $this->maLoaiBan;
		}
		public function setMaTrangThai($maTrangThai){
			$this->maTrangThai = $maTrangThai;
		}
		public function getMaTrangThai(){
			return $this->maTrangThai;
		}
		public function setTang($tang){
			$this->tang = $tang;
		}
		public function getTang(){
			return $this->tang;
		}
		
		public function countKhuVuc(){
			$this->setQuery("SELECT count( DISTINCT maKhuVuc )
								FROM Ban");
			return $this->fetchAll(); 
		}
		
		// lấy về bảng gồm 3 cột: makhuvuc, tenkhuvuc, soban
		public function getKhuVucBan(){
			$this->setQuery("select KhuVuc.maKhuVuc as makhuvuc, tenKhuVuc as tenkhuvuc, count(distinct msBan) as soban From Ban Join KhuVuc WHERE Ban.maKhuVuc = KhuVuc.maKhuVuc GROUP BY tenKhuVuc order by makhuvuc");
		 	return $this->executeQuery(); 
		}
		
		// lấy về danh sách bàn
		public function getTrangThaiBan(){
			$this->setQuery("select msBan as msban, maTrangThai as matrangthai from Ban order by msban");
			return  $this->executeQuery();
		}
	}
?>